<?php get_header() ?>
<?php locate_template( array( 'sidebar.php' ), true ) ?>
			<div class="content_box_big">
				<script type="text/javascript">
				jQuery.noConflict();
				jQuery(document).ready(function(){
					jQuery("#featured").tabs({fx:{opacity: "toggle", duration: "fast"}}).tabs("rotate", 5000, true);  
					jQuery("#featured").hover(
						function() {
						jQuery("#featured").tabs("rotate",0,true);  
						},  
						function() {  
						jQuery("#featured").tabs("rotate",5000,true);  
						}  
					);
				});;
				</script>
				<?php
				$query_array = array(
					array('numberposts' => 1, 'category__and' => array(54, 6)), //events
					array('numberposts' => 1, 'category__and' => array(7, 6)), //news
					array('numberposts' => 1, 'category__and' => array(59, 6)), //interview
					array('numberposts' => 1, 'category__and' => array(57, 6)) //general
					/*array('numberposts' => 1, 'category__and' => array(54, 50)), //events
					array('numberposts' => 1, 'category__and' => array(5, 50)), //news
					array('numberposts' => 1, 'category__and' => array(60, 50)), //interview
					array('numberposts' => 1, 'category__and' => array(53, 50)), //interview*/
				);			
				?>

				<div id="featured">
					<?php
					$i = 1;
					foreach ($query_array as $query_set) {
						$bb_news = new WP_Query($query_set);
						if ( $bb_news->have_posts() ) {
							$bb_news->the_post();
							//$excerpt = substr(get_the_excerpt(), 0, 210);
							$post_meta = get_post_custom();
							if (!empty($post_meta['billboard_title'][0])) {
								$title = $post_meta['billboard_title'][0];
							} else {
								$title = substr(get_the_title(), 0, 44);
							}
							echo '
								<div id="fragment-' . $i . '" class="ui-tabs-panel">
									<a href="' . get_permalink() . '">' . get_the_post_thumbnail($post->id, 'bb-panel') . '</a>
									 <div class="info">
										<h2><a href="' . get_permalink() . '">' . $title . '</a></h2>
										' . get_the_excerpt_max_charlength(get_the_excerpt(), 145) . '
									 </div>
								</div>';
							$bb_items .= '
								<li class="ui-tabs-nav-item" id="nav-fragment-' . $i . '"><a href="#fragment-' . $i . '">' . get_the_post_thumbnail($post->id, 'bb-item') . '</a></li>';
						}
						$i++;
					}
					?>
					<ul class="ui-tabs-nav">
						<?php echo $bb_items; ?>
					</ul>
				</div>
			</div>
			
		<div class="content_box">
			<div class="content_box_big" style="margin-bottom:0px">
				<div class="box_title">
					<div class="left">NEWS</div>
					<div class="right"><a href="<?php echo wts_get_link('news'); ?>">view all</a></div>
				</div>
			</div>
			<br class="clear" />
			<?php
			$even_posts = get_posts('numberposts=2&category_name=news');
			remove_filter('the_content', 'wpautop');
			foreach( $even_posts as $post )
			{
				setup_postdata($post);
				?>
			
			<div class="content_box_small">
				<div class="list_item">
					<a href="<?php the_permalink(); ?>"><h2><?php echo the_title(); ?></h2></a>
				<?php 
				the_excerpt();
				?>
				</div>
			</div>
				<?php
			}
			?>
			<br class="clear" />
			<div class="content_box_small">
				<div class="box_title">
					<div class="left">EVENTS</div>
					<div class="right"><a href="<?php echo wts_get_link('event_reviews'); ?>">view all</a></div>
				</div>
				<?php
				$news_posts = get_posts('numberposts=3&category_name=events');
				remove_filter('the_content', 'wpautop');
				foreach( $news_posts as $post )
				{
					setup_postdata($post);
					?>
					<div class="list_item">
						<b><?php echo get_the_date('D, jS F'); ?></b><br />
						<a href="<?php the_permalink(); ?>"><h2><?php echo the_title(); ?></h2></a>
						<?php
						if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
				  			the_post_thumbnail('small-thumb');
						} 
						the_excerpt();
						?>
					</div>
					<?php
				}
				?>
			</div>
			<div class="content_box_small">
				<div class="box_title">
					<div class="left">ARTICLES</div>
					<div class="right"><a href="<?php echo wts_get_link('articles'); ?>">view all</a></div>
				</div>
				<?php
				$articles_posts = get_posts('numberposts=3&category_name=articles');
				remove_filter('the_content', 'wpautop');
				foreach( $articles_posts as $post )
				{
					setup_postdata($post);
					?>
					<div class="topline">
						<div class="list_item">
						<a href="<?php the_permalink(); ?>"><h2><?php echo the_title(); ?></h2></a>
						<?php
						the_excerpt();
						?>
						</div>
					</div>
					<?php
				}
				?>
			</div>
		</div>
<?php get_footer() ?>
